/*
 * @Date: 2025-02-25 11:36:49
 * @LastEditors: 吴世扬 18368095041@163.com
 * @LastEditTime: 2025-02-25 11:39:47
 * @FilePath: /vue3-admin/src/api/file.ts
 */

import { request } from '@/utils';

import type { UploadResultData } from '@/typings/api/file';

class UploadParam {
    bucket?: string;

    remark?: string;

    type?: number; // 文件类型：1-图片 2-视频 3-音频 4-Word文档 5-PDF 99-其他

    file?: File;
}

export const fileUpload = (data: UploadParam) => {
    return request<HttpResult<UploadResultData>>({
        url: '/admin/api/v1/file/upload',
        method: 'post',
        headers: {
            'Content-Type': 'multipart/form-data'
        },
        data
    }).then((res) => res.data);
};
